home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / Development Tools & Languages / Macintosh Common Lisp Related / interfaces / QuickdrawText.lisp < prev    next >
Encoding:
Text File  |  1993-09-16  |  10.1 KB  |  270 lines  |  [TEXT/CCL2]

  1. (in-package :traps)
  2. ;
  3. ;    File:        QuickdrawText.p
  4. ;
  5. ;    Copyright:    © 1983-1993 by Apple Computer, Inc.
  6. ;                All rights reserved.
  7. ;
  8. ;    Version:    System 7.1 for ETO #11
  9. ;    Created:    Tuesday, March 30, 1993 18:00
  10. ;
  11. ;       adaptated for MCL 2.0 by Gilles Serasset, GETA-IMAG, France
  12.  
  13. ;$IFC UNDEFINED UsingIncludes
  14. ;$SETC UsingIncludes := 0
  15. ;$ENDC
  16.  
  17. ;$IFC NOT UsingIncludes
  18. ;UNIT QuickdrawText;
  19. ;INTERFACE
  20. ;$ENDC
  21.  
  22. ;$IFC UNDEFINED UsingQuickdrawText
  23. ;$SETC UsingQuickdrawText := 1
  24.  
  25. ;$I+
  26. ;$SETC QuickdrawTextIncludes := UsingIncludes
  27. ;$SETC UsingIncludes := 1
  28. ;$IFC UNDEFINED UsingTypes
  29.  
  30. (require-interface 'types)               ;$I $$Shell(PInterfaces)Types.p
  31. ;$ENDC
  32.  
  33. ;$IFC UNDEFINED UsingIntlResources
  34.  
  35. (require-interface 'IntlResources)      ;$I $$Shell(PInterfaces)IntlResources.p
  36. ;$ENDC
  37.  
  38. ;$SETC UsingIncludes := QuickdrawTextIncludes
  39.  
  40. ; constants
  41.  
  42. ; CharToPixel directions
  43. (defconstant $leftCaret 0)                 ;Place caret for left block
  44. (defconstant $rightCaret -1)               ;Place caret for right block
  45. (defconstant $hilite 1)                    ;Direction is SysDirection
  46.  
  47. (defconstant $smLeftCaret 0)               ;Place caret for left block, obsolete
  48. (defconstant $smRightCaret -1)             ;Place caret for right block, obsolete 
  49. (defconstant $smHilite 1)                  ;Direction is TESysJust, obsolete
  50.  
  51. ;     Constants for styleRunPosition argument in PortionLine, DrawJustified,
  52. ;     MeasureJustified, CharToPixel, and PixelToChar.
  53. (defconstant $onlyStyleRun 0)              ; This is the only style run on the line 
  54. (defconstant $leftStyleRun 1)              ; This is leftmost of multiple style runs on the line 
  55. (defconstant $rightStyleRun 2)             ; This is rightmost of multiple style runs on the line 
  56. (defconstant $middleStyleRun 3)            ; There are multiple style runs on the line and this 
  57.                                            ; is neither the leftmost nor the rightmost. 
  58. (defconstant $smOnlyStyleRun 0)            ; obsolete  
  59. (defconstant $smLeftStyleRun 1)            ; obsolete  
  60. (defconstant $smRightStyleRun 2)           ; obsolete  
  61. (defconstant $smMiddleStyleRun 3)          ; obsolete
  62.  
  63.  
  64. ; type for styleRunPosition parameter in PixelToChar etc. 
  65. (def-mactype :JustStyleCode (find-mactype :signed-integer))
  66.  
  67. (defrecord FontInfo
  68.   (ascent :signed-integer)
  69.   (descent :signed-integer)
  70.   (widMax :signed-integer)
  71.   (leading :signed-integer)
  72.   )
  73.  
  74. (defrecord FormatOrder (array (array :signed-integer 1)))
  75. (def-mactype :FormatOrderPtr (find-mactype :pointer))
  76. (def-mactype :FormatStatus (find-mactype :signed-integer))
  77.  
  78.  
  79.  
  80. (deftrap _Pixel2Char ((textBuf :pointer) (textLen :signed-integer) (slop :signed-integer)
  81.                       (pixelWidth :signed-integer) (leadingEdge (:pointer :boolean)))
  82.   (:stack :signed-integer)
  83.   (:stack-trap #xA8B5 textBuf textLen slop pixelWidth leadingEdge ((+ (ash 33294 16) 20) :signed-longint)))
  84.  
  85.  
  86. (deftrap _Char2Pixel ((textBuf :pointer) (textLen :signed-integer) (slop :signed-integer)
  87.                       (offset :signed-integer) (direction :signed-integer))
  88.   (:stack :signed-integer)
  89.   (:stack-trap #xA8B5 textBuf textLen slop pixelWidth leadingEdge ((+ (ash 33292 16) 22) :signed-longint)))
  90.  
  91.  
  92. ;  New for 7.0  
  93. (deftrap _PixelToChar ((textBuf :pointer) (textLen :signed-long) (slop :fixed)
  94.                        (pixelWidth :fixed) (leadingEdge (:pointer :boolean))
  95.                        (widthRemaining (:pointer :Fixed)) (styleRunPosition :JustStyleCode)
  96.                        (numer :point) (denom :point))
  97.   (:stack :signed-integer)
  98.   (:stack-trap #xA8B5 textBuf textLen slop pixelWidth leadingEdge widthRemaining styleRunPosition 
  99.                numer denom ((+ (ash 33314 16) 46) :signed-longint)))
  100.  
  101. (deftrap _NPixel2Char ((textBuf :pointer) (textLen :signed-long) (slop :fixed)
  102.                        (pixelWidth :fixed) (leadingEdge (:pointer :boolean))
  103.                        (widthRemaining (:pointer :Fixed)) (styleRunPosition :JustStyleCode)
  104.                        (numer :point) (denom :point))
  105.   (:stack :signed-integer)
  106.   (:stack-trap #xA8B5 textBuf textLen slop pixelWidth leadingEdge widthRemaining styleRunPosition 
  107.                numer denom ((+ (ash 33314 16) 46) :signed-longint)))
  108.  
  109. (deftrap _CharToPixel ((textBuf :pointer) (textLen :signed-long) (slop :fixed)
  110.                        (offset :signed-long) (direction :signed-integer)
  111.                        (styleRunPosition :JustStyleCode) (numer :point) (denom :point))
  112.   (:stack :signed-integer)
  113.   (:stack-trap #xA8B5 textBuf textLen slop offset direction styleRunPosition 
  114.                numer denom ((+ (ash 33308 16) 48) :signed-longint)))
  115.  
  116. (deftrap _NChar2Pixel ((textBuf :pointer) (textLen :signed-long) (slop :fixed)
  117.                        (offset :signed-long) (direction :signed-integer)
  118.                        (styleRunPosition :JustStyleCode) (numer :point) (denom :point))
  119.   (:stack :signed-integer)
  120.   (:stack-trap #xA8B5 textBuf textLen slop offset direction styleRunPosition 
  121.                numer denom ((+ (ash 33308 16) 48) :signed-longint)))
  122.  
  123. (deftrap _DrawJustified ((textPtr :pointer) (textLength :signed-long) (slop :Fixed)
  124.                          (styleRunPosition :JustStyleCode) (numer :Point) (denom :Point))
  125.   nil
  126.   (:stack-trap #xA8B5 textPtr textLength slop styleRunPosition numer denom 
  127.                ((+ (ash 32790 16) 50) :signed-longint)))
  128.  
  129. (deftrap _NDrawJust ((textPtr :pointer) (textLength :signed-long) (slop :Fixed)
  130.                      (styleRunPosition :JustStyleCode) (numer :Point) (denom :Point))
  131.   nil
  132.   (:stack-trap #xA8B5 textPtr textLength slop styleRunPosition numer denom 
  133.                ((+ (ash 32790 16) 50) :signed-longint)))
  134.  
  135. (deftrap _MeasureJustified ((textPtr :pointer) (textLength :signed-long) (slop :Fixed)
  136.                             (charLocs :pointer) (styleRunPosition :JustStyleCode) (numer :Point)
  137.                             (denom :Point))
  138.   nil
  139.   (:stack-trap #xA8B5 textPtr textLength slop charLocs styleRunPosition numer denom 
  140.                ((+ (ash 32794 16) 52) :signed-longint)))
  141.  
  142. (deftrap _NMeasureJust ((textPtr :pointer) (textLength :signed-long) (slop :Fixed)
  143.                             (charLocs :pointer) (styleRunPosition :JustStyleCode) (numer :Point)
  144.                             (denom :Point))
  145.   nil
  146.   (:stack-trap #xA8B5 textPtr textLength slop charLocs styleRunPosition numer denom 
  147.                ((+ (ash 32794 16) 52) :signed-longint)))
  148.  
  149. (deftrap _NPortionText ((textPtr :pointer) (textLen :signed-long) (styleRunPosition :JustStyleCode)
  150.                         (numer :Point) (denom :Point))
  151.   (:stack :fixed)
  152.   (:stack-trap #xA8B5 textPtr textLen styleRunPosition numer denom 
  153.                ((+ (ash 33810 16) 54) :signed-longint)))
  154.  
  155. (deftrap _PortionLine ((textPtr :pointer) (textLen :signed-long) (styleRunPosition :JustStyleCode)
  156.                         (numer :Point) (denom :Point))
  157.   (:stack :fixed)
  158.   (:stack-trap #xA8B5 textPtr textLen styleRunPosition numer denom 
  159.                ((+ (ash 33810 16) 54) :signed-longint)))
  160.  
  161. (deftrap _HiliteText ((textPtr :pointer) (textLength :signed-integer) (firstOffset :signed-integer)
  162.                       (secondOffset :signed-integer) (offsets (:pointer :OffsetTable)))
  163.   nil
  164.   (:stack-trap #xA8B5 textPtr textLength firstOffset secondOffset offsets 
  165.                ((+ (ash 32782 16) 28) :signed-longint)))
  166.  
  167. (deftrap _DrawJust ((textPtr :pointer) (textLength :signed-integer) (slop :signed-integer))
  168.   nil
  169.   (:stack-trap #xA8B5 textPtr textLength slop ((+ (ash 32776 16) 30) :signed-longint)))
  170.  
  171. (deftrap _MeasureJust ((textPtr :pointer) (textLength :signed-integer) (slop :signed-integer)
  172.                        (charLocs :pointer))
  173.   nil
  174.   (:stack-trap #xA8B5 textPtr textLength slop ((+ (ash 32780 16) 32) :signed-longint)))
  175.  
  176.  
  177.  
  178. (deftrap _PortionText ((textPtr :pointer) (textLen :signed-long))
  179.   (:stack :fixed)
  180.   (:stack-trap #xA8B5 textPtr textLen ((+ (ash 33800 16) 36) :signed-longint)))
  181.  
  182. (deftrap _VisibleLength ((textPtr :pointer) (textLen :signed-long))
  183.   (:stack :signed-long)
  184.   (:stack-trap #xA8B5 textPtr textLen ((+ (ash 33800 16) 40) :signed-longint)))
  185.  
  186. (deftrap _GetFormatOrder ((ordering :FormatOrderPtr) (firstFormat :signed-integer)
  187.                           (lastFormat :signed-integer) (lineRight :boolean) (rlDirProc :pointer)
  188.                           (dirParam :pointer))
  189.   nil
  190.   (:stack-trap #xA8B5 ordering firstFormat lastFormat lineRight rlDirProc dirParam 
  191.                ((+ (ash 32786 16) 65532) :signed-longint)))
  192.  
  193.  
  194. (deftrap _TextFont ((font :signed-integer))
  195.   nil
  196.   (:stack-trap #xA887))
  197.  
  198. (deftrap _TextFace ((face :style))
  199.   nil
  200.   (:stack-trap #xA888))
  201.  
  202. (deftrap _TextMode ((mode :signed-integer))
  203.   nil
  204.   (:stack-trap #xA889))
  205.  
  206. (deftrap _TextSize ((size :signed-integer))
  207.   nil
  208.   (:stack-trap #xA88A))
  209.  
  210. (deftrap _SpaceExtra ((extra :Fixed))
  211.   nil
  212.   (:stack-trap #xA88E))
  213.  
  214. (deftrap _DrawChar ((ch :character))
  215.   nil
  216.   (:stack-trap #xA883))
  217.  
  218. (deftrap _DrawString ((s (:string 255)))
  219.   nil
  220.   (:stack-trap #xA884))
  221.  
  222. (deftrap _DrawText ((textBuf :pointer) (firstByte :signed-integer) (byteCount :signed-integer))
  223.   nil
  224.   (:stack-trap #xA885))
  225.  
  226. (deftrap _CharWidth ((ch :character))
  227.   (:stack :signed-integer)
  228.   (:stack-trap #xA88D))
  229.  
  230. (deftrap _StringWidth ((s (:string 255)))
  231.   (:stack :signed-integer)
  232.   (:stack-trap #xA88C))
  233.  
  234. (deftrap _TextWidth ((textBuf :pointer) (firstByte :signed-integer) (byteCount :signed-integer))
  235.   (:stack :signed-integer)
  236.   (:stack-trap #xA886))
  237.  
  238. (deftrap _MeasureText ((count :signed-integer) (textAddr :pointer) (charLocs :pointer))
  239.   nil
  240.   (:stack-trap #xA837))
  241. `
  242.  
  243. (deftrap _GetFontInfo ((info (:pointer :FontInfo)))
  244.   nil
  245.   (:stack-trap #xA88B))
  246.  
  247.  
  248. (deftrap _CharExtra ((extra :Fixed))
  249.   nil
  250.   (:stack-trap #xAA23))
  251.  
  252. (deftrap _StdText ((count :signed-integer) (textAddr :pointer) (numer :point) (denom :point))
  253.   nil
  254.   (:stack-trap #xA882))
  255.  
  256. (deftrap _StdTxMeas ((byteCount :signed-integer) (textAddr :pointer) (numer (:pointer :point))
  257.                      (denom (:pointer :point)) (info (:pointer :FontInfo)))
  258.   (:stack :signed-integer)
  259.   (:stack-trap #xA8ED))
  260.  
  261.  
  262. (export '($leftCaret $rightCaret $hilite $smLeftCaret $smRightCaret $smHilite $onlyStyleRun
  263.           $leftStyleRun $rightStyleRun $middleStyleRun $smOnlyStyleRun $smLeftStyleRun $smRightStyleRun
  264.           $smMiddleStyleRun))
  265.  
  266. (provide-interface 'quickdrawtext)
  267.  
  268.  
  269.  
  270.